﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using proRFID_DiemDanh.Chung;
using System.Data;
using System.Data.SqlClient;
namespace proRFID_DiemDanh.Khoa
{
    public class mdKhoa
    {
        public static DataTable sp_Khoa_Insert(string TenKhoa)
        {
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = new SqlCommand("sp_Khoa_Insert", mdMain.cnn);
            da.SelectCommand.CommandType = CommandType.StoredProcedure;
            da.SelectCommand.Parameters.AddWithValue("@TenKhoa", TenKhoa);
            DataTable dt = new DataTable();
            da.Fill(dt);
            return dt;
        }
        public static DataTable sp_Khoa_Select(int MaKhoa)
        {
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = new SqlCommand("sp_Khoa_Select", mdMain.cnn);
            da.SelectCommand.CommandType = CommandType.StoredProcedure;
            da.SelectCommand.Parameters.AddWithValue("@MaKhoa", MaKhoa);
            DataTable dt = new DataTable();
            da.Fill(dt);
            return dt;
        }
        public static DataTable sp_Khoa_Update(int MaKhoa, string TenKhoa)
        {
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = new SqlCommand("sp_Khoa_Update", mdMain.cnn);
            da.SelectCommand.CommandType = CommandType.StoredProcedure;
            da.SelectCommand.Parameters.AddWithValue("@MaKhoa", MaKhoa);
            da.SelectCommand.Parameters.AddWithValue("@TenKhoa", TenKhoa);
            DataTable dt = new DataTable();
            da.Fill(dt);
            return dt;
        }
        public static DataTable sp_Khoa_Delete(int MaKhoa)
        {
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = new SqlCommand("sp_Khoa_Delete", mdMain.cnn);
            da.SelectCommand.CommandType = CommandType.StoredProcedure;
            da.SelectCommand.Parameters.AddWithValue("@MaKhoa", MaKhoa);
            DataTable dt = new DataTable();
            da.Fill(dt);
            return dt;
        }
    }
}